#include "request-client.hh"

#include <tools/utility.hh>

ConnectionClient::ConnectionClient (const std::string& data):
  msg_ (data)
{
}

GetObjectClient::GetObjectClient (const std::string& data)
{
  const char* buf = data.data ();

  objectid_ = Utility::from_oct (buf);
  buf += 4;

  meshid_ = Utility::from_oct (buf);
  buf += 4;

  unsigned char c = *buf;
  if (!(c & 256))
    bounding_ = new BoundingSphere (c);
  else
  {
    std::cout << "BoundingSphere is the only type of bounding accepted ATM" << std::endl;
    assert (false);
  }

  ++buf;
  angle_.fromnet (buf, 12);

  buf += 12;
  pos_.fromnet (buf, 12);
}

AskMapClient::AskMapClient (const std::string& data)
{
  size_ = Utility::from_oct (data.c_str ());
}
